Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support transparency #18

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

support transparency #18

wants to merge 4 commits into from

Conversation

t-bltg
Copy link
Collaborator

@t-bltg t-bltg commented Aug 11, 2022

Fix #17.

PR (mlterm)
eqn

master
schrodinger

@codecov
Copy link

codecov bot commented Aug 11, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@07011d3). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master      #18   +/-   ##
=========================================
  Coverage          ?   41.19%           
=========================================
  Files             ?       10           
  Lines             ?      352           
  Branches          ?        0           
=========================================
  Hits              ?      145           
  Misses            ?      207           
  Partials          ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@t-bltg
Copy link
Collaborator Author

t-bltg commented Aug 30, 2022

@johnnychen94 ?

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed it.

Would you mind adding a test for this?

src/backend/libsixel/encoder.jl Outdated Show resolved Hide resolved
src/backend/libsixel/encoder.jl Outdated Show resolved Hide resolved
@t-bltg
Copy link
Collaborator Author

t-bltg commented Aug 30, 2022

Regarding the tests, there is something fundamentally fishy with src/terminaltools.jl: query_terminal requires stdin fd to be opened, and under the tests, stdin is closed since tests are ran under non interactive mode, so testing is not representative.
==> side effect of JuliaLang/Pkg.jl#3065.

I couldn't find a way to fake stdin when querying sixel support, so I'm a bit stuck here @johnnychen94.

@johnnychen94
Copy link
Member

Why would you need the interactive mode to run the test? I mean, it's more or less like how

for img in (
repeat(Gray.(0:0.1:0.9), inner=(10, 50)),
repeat(distinguishable_colors(10), inner=(10, 50))
)
does for RGBA, right?

img = rand(RGBA, 5, 5)
io = IOBuffer()
sixel_encode(io, img)
@test ref == String(take!(io))

@t-bltg
Copy link
Collaborator Author

t-bltg commented Aug 30, 2022

I got confused by

sixel_output || @info "Current terminal does not support sixel format sequence. Display tests to stdout will be marked as broken."

@johnnychen94
Copy link
Member

sixel_encode supports three outputs:

  • sixel_encode(img): println to stdout. This requires interactive mode (actually not, but CI environment doesn't support sixel)
  • sixel_encode(::IO, img)

It's okay to use IOBuffer to get the encoded sequence and test against it.

@t-bltg
Copy link
Collaborator Author

t-bltg commented Aug 30, 2022

Last commit is optional, let me know I you don't want it.

@t-bltg t-bltg marked this pull request as draft September 5, 2022 10:33
@t-bltg
Copy link
Collaborator Author

t-bltg commented Sep 5, 2022

Let's put this on hold since the real fix would (hopefully) be brought by libsixel/libsixel#23.

I'm planning of bumping libsixel to 1.10.3 (JuliaPackaging/Yggdrasil#5432 - might require running gen/generator.jl here).

@ctrlcctrlv
Copy link

@t-bltg Perhaps we should work together instead of separately, as I got a bit scared off by all the memory safety issues in libsixel so have been afraid to make big changes to the C code, especially because we know for a fact the current API's aren't even able to be made safe as a few of them lack critical information like data size.

I don't know Julia, sorry, but my longterm plan upstream has been to:

  • switch the core library to another language, probably Rust if I were to be its main developer as that's the language I know best for systems programming;
  • write a C ABI mimicking the existing C API.

@t-bltg
Copy link
Collaborator Author

t-bltg commented Nov 21, 2022

That's certainly a good idea to transition to rust if you want something similar to current c interface. I must admit I never wrote rust code (lots of Fortran and C, and obviously julia) ;). But if I can help in any way ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support transparent background
3 participants